#ifndef	_GLOVAREXTDEF_H
#define	_GLOVAREXTDEF_H
//
#ifdef __cplusplus
extern "C" {
#endif
//
#include "GenTypeDef.h"
//*******************************************************************
//     ----Please extern  your globle variable definition here----
//             ------for example below-----------------
//*******************************************************************
//-------extern globle variable definiton----
// debug
extern char JS_RTT_UpBuffer[];    // J-Scope RTT Buffer
extern int  JS_RTT_Channel;       // J-Scope RTT Channel
#if (DEBUG_FOC_OUTPUT == 1)
extern LONG   DebugBuf_0[];
extern LONG   DebugBuf_1[];
extern LONG   DebugBuf_2[];
extern LONG   DebugBuf_3[];
extern uSHORT DBCnt;
#endif
// system
extern uCHAR   g_Cnt1ms;
extern uLONG   g_CntPWM;
// speed and Ibus
extern LONG    g_SetSpeed;
extern LONG    g_ActualSpeed;
extern uLONG   g_SpeedRangeMin;
extern uSHORT  g_SetIBus;
extern uSHORT  g_ActualIBus;
// PID
extern LONG    g_Speed_PID_Data;
extern LONG    g_Curr_D_PID_Data;
extern LONG    g_Curr_Q_PID_Data;
extern LONG    g_IBus_PID_Data;
//
extern uSHORT  g_Speed_PID_Cycle;
// PWM 
extern uLONG   g_PWM_Frequency;
extern uLONG   g_PWM_Period;
extern uLONG   g_PWMLoadData;
extern uCHAR   g_PWM_CCR_Duty;
extern uSHORT  g_PWM_CCR_Data;
extern uCHAR   g_PWM_InverseIndex;
// ADC
extern uSHORT  g_VoltageRES1;
extern uSHORT  g_VoltageRES2;
extern uSHORT  g_VoltageMotor;
extern uSHORT  g_VoltageSpeed;
extern uSHORT  g_VoltageMosTemp;
extern uSHORT  g_ADC_RegularConvertedValueTab[];
extern uSHORT  g_ADC_InjectedConvertedValueTab[];
extern uSHORT  g_CurrIBusAVG;
extern SHORT   g_CurrIBusBuf[];
extern LONG    g_CurrIBus_Offset;
extern uCHAR   g_CurrOffset_Cnt;
extern uLONG   g_ADC_ExternalTrigSource;
// motor
extern uCHAR   g_MotorPolePairs;
extern uCHAR   g_ForRevDir;
extern uCHAR   g_ForRevDirUpdate;
extern uCHAR   g_DirRotCnt;
// Key
extern uSHORT  g_Key1Cnt;
extern uSHORT  g_Key2Cnt;
// angle
extern SHORT   g_Angle;
// circle
extern uLONG   CircleModulation;
extern uCHAR   CircleStartIndex;
// protect
extern uSHORT  g_CntOCP;
extern uSHORT  g_CntLRCP;
extern uSHORT  g_CntLRPP;
extern uSHORT  g_CntUVP;
extern uSHORT  g_CntOVP;
extern uSHORT  g_CntOTP;
extern uSHORT  g_CntLED;
extern uSHORT  g_DelayTimeOCP;
extern uSHORT  g_DelayTimeUVP;
extern uSHORT  g_DelayTimeOVP;
extern uSHORT  g_DelayTimeOTP;
extern uSHORT  g_CntACP;
extern uSHORT  g_DelayTimeACP;
extern uSHORT  g_DelayTimeLED;
// Stage
extern T_STAGE  g_Stage;
// Bool
extern T_BOOL   ResultFS;
extern T_BOOL   ResultBS;
// Index
extern T_INDEX  INDEX_FS;
extern T_INDEX  INDEX_BS;
extern T_FOC_INDEX INDEX_FOC;
// Flag
extern T_DELAY    delay;
extern T_TIMEOUT  timeout;
extern T_PROTECT  protect;
extern T_FLAG     flag;
// FOC
extern T_CurrComps  Curr_A_B;
extern T_CurrComps  Curr_ALFA_BETA;
extern T_CurrComps  Curr_D_Q;
extern T_CurrComps  Curr_D_Q_REF;
extern T_VoltComps  Volt_D_Q;
extern T_VoltComps  Volt_ALFA_BETA;
extern T_TrigComps  Trig;
extern T_SVPWMComps  SVPWM;
// PID
extern T_INC_PID  SpeedPID;
extern T_INC_PID  IBusPID;
extern T_INC_PID  Curr_D_PID;
extern T_INC_PID  Curr_Q_PID;
// SMC
extern T_SLIDE_MODE_CTRL  SMC;
// MDM
extern T_MOTOR_DIG_MODE   MDM;
//
//----------end extern globle data definition-------------------
//
#ifdef __cplusplus
}
#endif
//
#endif	//_GLOVAREXTDEF_H

